{extend name='public/base' /}
{block name="css"}

{/block}
{block name="content"}
<div class="layui-card">
    <div class="layui-card-header" style="height: 70px; line-height: 70px;">
            <span id="titleBox" style="font-size: 20px;font-weight: bolder">

            </span>
        <div style="line-height: 70px;float: right;vertical-align: middle;margin-left: 15px">
            <button class="layui-btn layui-btn-sm icon-btn" id="backBtn">
                <i class="layui-icon">&#xe65c;</i>返回
            </button>
        </div>
        <span id="publicInfoBox" style="font-size: 14px;float: right;">
                发布人：<span id="publicUserNameBox"></span>&nbsp;&nbsp;发布部门：<span id="publicOrgNameBox"></span>&nbsp;&nbsp;发布时间：<span id="publicTimeBox"></span>
            </span>
    </div>
    <div class="layui-card-body" id="contentBox">

    </div>
</div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>阅读信息</legend>
</fieldset>
<div class="layui-card">
    <div class="layui-card-body">
        <!-- 数据表格 -->
        <table id="dataTable" lay-filter="dataTable"></table>
    </div>
</div>
{/block}
{block name="js"}
<!-- 加载动画 -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>
<!-- js部分 -->
<script>
    layui.use(['layer', 'table', 'tableX', 'notice', 'xnUtil'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var table = layui.table;
        var tableX = layui.tableX;
        var admin = layui.admin;
        var notice = layui.notice;
        var xnUtil = layui.xnUtil;

        var formNoticeId = admin.getTempData('formNoticeId');
        admin.req('detail?id=' + formNoticeId, function(res){
            admin.removeLoading();
            $('#titleBox').text(res.data.title);
            $('#contentBox').html(res.data.content);
            $('#publicUserNameBox').text(res.data.public_user_name);
            $('#publicOrgName').text(res.data.public_org_name);
            $('#publicTimeBox').text(res.data.public_time);
            if(res.data.status === 2) {
                $('#publicInfoBox').append('&nbsp;&nbsp;撤回时间：' + res.data.cancel_time);
            }
            table.render({
                elem: '#dataTable',
                data: res.data.user_read_list,
                page: false,
                cols: [
                    [
                        {field: 'user_name', title: '用户名称'},
                        {field: 'read_status', title: '阅读状态', templet: function (d) { return xnUtil.rendDataTableDict(d.read_status, 'read_status'); } },
                        {field: 'read_time', title: '阅读时间'}
                    ]
                ]
            });

        }, {async: false});

        $('#backBtn').click(function () {
            window.location.href="javascript:history.go(-1)";
        });
    });
</script>
{/block}